package com.demo.fastjson;

import com.alibaba.fastjson.serializer.PropertyFilter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author Administrator
 */
public class StringNotBlankFilter implements PropertyFilter {

    @Override
    public boolean apply(Object object, String name, Object value) {
        if (Objects.isNull(value)) {
            return false;
        }

        if (value instanceof String) {
            return StringUtils.isNotBlank((String)value);
        }
        return true;
    }
}
